﻿Imports System.Web.SessionState
Imports System
Imports System.Web.Routing
Imports System.Web
Imports System.Web.Compilation
Imports System.Collections

Public Class Global_asax
    Inherits System.Web.HttpApplication

    Shared Sub RegisterRoutes(ByVal routes As RouteCollection)

        'Note: Setup routing for ASP.Net pages

        Dim urlPattern As String

        Dim pageRoute As Route

        'To support IIS6 routes end with aspx
        urlPattern = "{pageName}.aspx"

        'All requests are actually handled by the Default.aspx page
        pageRoute = New Route(urlPattern, New PageRouteHandler("~/Default.aspx"))

        'The default route is to the "Home" page.
        pageRoute.Defaults = New RouteValueDictionary(New With {.pageName = "Home"})

        routes.Add(pageRoute)

        'These are used to exclude requests for embedded resources and javascript files
        routes.Add(New Route("{resource}.axd/{*pathInfo}", New StopRoutingHandler()))
        routes.Add(New Route("{resource}.js", New StopRoutingHandler()))

    End Sub

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started

        RegisterRoutes(Routing.RouteTable.Routes)

    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session is started
    End Sub

    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires at the beginning of each request
    End Sub

    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires upon attempting to authenticate the use
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when an error occurs
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session ends
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application ends
    End Sub

End Class